{% extends "extends/base_all_.html" %}

{% block content %}
<!-- 页头导航栏 -->
<nav class="navbar navbar-expand-lg navbar-dark" style="background-color: #6c757d;">
    <div class="container">
        <a class="navbar-brand" href="#" id="logo">互助湖经</a>
        <button class="navbar-toggler" type="button" data-bs-toggle="collapse" data-bs-target="#navbarNav"
            aria-controls="navbarNav" aria-expanded="false" aria-label="Toggle navigation">
            <span class="navbar-toggler-icon"></span>
        </button>

        <div class="collapse navbar-collapse" id="navbarNav">
    <ul class="navbar-nav ms-auto">
        <!-- 首页 -->
        <li class="nav-item">
            <a class="nav-link active" aria-current="page" id="home-link" href="#">首页</a>
        </li>

        <!-- 博客 下拉菜单 -->
        <li class="nav-item dropdown">
            <a class="nav-link dropdown-toggle" href="#" id="navbarDropdown" role="button"
               data-bs-toggle="dropdown" aria-expanded="false">
                博客
            </a>
            <ul class="dropdown-menu dropdown-menu-dark" aria-labelledby="navbarDropdown">
                <li><a class="dropdown-item" id="hot-blog-link" href="#">热门</a></li>
                <li><a class="dropdown-item" id="recent-blog-link" href="#">最新</a></li>
                <li><a class="dropdown-item" id="friend-link" href="#">交友</a></li>
                <li><a class="dropdown-item" id="help-link" href="#">求助</a></li>
                <li><a class="dropdown-item" id="trade-link" href="#">交易</a></li>
                <li><a class="dropdown-item" id="my-follow-link" href="#">我的关注</a></li>
                <li><a class="dropdown-item" id="similar-recommend-link" href="#">相似推荐</a></li>
            </ul>
        </li>

        <!-- 管理 下拉菜单 -->
        <li class="nav-item dropdown">
            <a class="nav-link dropdown-toggle" href="#" id="navbarDropdownManage" role="button"
               data-bs-toggle="dropdown" aria-expanded="false">
                管理
            </a>
            <ul class="dropdown-menu dropdown-menu-dark" aria-labelledby="navbarDropdownManage">
                <li><a class="dropdown-item" id="my-posts-link" href="#">我的帖子</a></li>
                <li><a class="dropdown-item" id="my-comments-link" href="#">我的评论</a></li>
                <li><a class="dropdown-item" id="my-likes-link" href="#">点赞关注</a></li>
            </ul>
        </li>

        <!-- 设置 -->
        <li class="nav-item">
            <a class="nav-link" id="publish-link" href="#">发布</a>
        </li>

        <li class="nav-item">
            <a class="nav-link" id="datas-link" href="#">数据</a>
        </li>

        <li class="nav-item">
            <a class="nav-link" id="infos-link" href="#">信息</a>
        </li>

        <!-- 登出 -->
        <li class="nav-item">
            <a class="nav-link" id="logout-link" href="#">登出</a>
        </li>
    </ul>
</div>
    </div>
</nav>


<script>
document.addEventListener('DOMContentLoaded', () => {
    onUrlsReady((urls) => {
        //TODO
        Element_('logo').href = urls.page.front.home
        Element_('home-link').href=urls.page.front.home

        Element_('recent-blog-link').href=urls.page.front.blogrecent
        Element_('hot-blog-link').href=urls.page.front.bloghot

        Element_('friend-link').href=urls.page.front.bloglistbymakefriends
        Element_('help-link').href=urls.page.front.bloglistbyhelp
        Element_('trade-link').href=urls.page.front.bloglistbytrade

        Element_('my-follow-link').href=urls.page.front.bloglistbyfollowing
        Element_('similar-recommend-link').href=urls.page.front.bloglistbysimilar

        Element_('my-posts-link').href=urls.page.front.myblogs
        Element_('my-comments-link').href=urls.page.front.mycomments
        Element_('my-likes-link').href=urls.page.front.mylikesfollows

        Element_('publish-link').href=urls.page.front.publish_new
        Element_('datas-link').href=urls.page.front.data
        Element_('infos-link').href=urls.page.front.information

        Event_('logout-link','click',event=>{
            Fetch(urls.service.login,'delete',{},async res => {
                await Flash(res.msg)
                Redirect(urls.page.login)
            })
        })
    });
})
</script>
{% block main %}
{% endblock %}

{% endblock %}
